﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace vpowerpoint
{
    public partial class Settings : Form
    {
        public String IP { get { return textBox1.Text + "." + textBox2.Text + "." + textBox3.Text + "." + textBox4.Text + "."; } }
        public Settings()
        {
            InitializeComponent();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            SaveSettings();
            this.Hide();
        }

        private void SaveSettings()
        {
            vpowerpoint.Properties.Settings.Default.remotip = IP;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void checkBox1_CheckedChanged_1(object sender, EventArgs e)
        {
            textBox1.Enabled =
               textBox2.Enabled =
               textBox3.Enabled =
               textBox4.Enabled =
               textBox5.Enabled =
               textBox6.Enabled = !checkBox1.Checked;
            if (checkBox1.Checked)
            {
                textBox1.Text = "127";
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SendPingToDevice();
        }

        private void SendPingToDevice()
        {
            //throw new NotImplementedException();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            String ip = vpowerpoint.Properties.Settings.Default.remotip;
            String[] address_part = ip.Split('.');
            textBox2.Text = address_part[0];
            textBox3.Text = address_part[1];
            textBox4.Text = address_part[2];
            textBox5.Text = address_part[3];
        }
    }
}
